<template>
  <uni-nav-bar title="提现订单" left-icon="left" @clickLeft="navBack" :fixed="true" statusBar></uni-nav-bar>
  <view class="package" v-if="friendAll">
    <view class="space-between">
      <view>订单</view>
      <view>{{friendAll.order_sn}}</view>
    </view>
    <view class="space-between top">
      <view>提现人</view>
      <view>{{friendAll.driver_name}}</view>
    </view>
    <view class="space-between top">
      <view>提现金额</view>
      <view>￥{{friendAll.money}}</view>
    </view>
    <view class="space-between top">
      <view>状态</view>
      <view>{{friendAll.status_text}}</view>
    </view>
    <view class="space-between top">
      <view>微信号</view>
      <view>{{friendAll.wechat}}</view>
    </view>
    <view class="space-between top">
      <view>提交时间</view>
      <view>{{friendAll.createtime}}</view>
    </view>
    <view class="space-between top">
      <view>发放时间</view>
      <view>{{friendAll.updatetime}}</view>
    </view>
  </view>
  <view class="package space-between" @click="navTo('administrator/carFriend/alteration?id='+order_ID)">
    <view>变动明细</view>
    <uni-icons type="right" size="25"></uni-icons>
  </view>
  <view class="package direction-start" v-if="friendAll.image">
    <view>微信转账截图：</view>
    <image :src="friendAll.image" mode="" style="width:200rpx;height:200rpx;margin-top:20rpx;"></image>
  </view>
  <view class="package direction-start" v-if="friendAll.admin_name">
    <view>已审核：</view>
    <view>已审核人:{{friendAll.admin_name}}</view>
  </view>
  <view class="package direction-start" v-if="friendAll.des">
    <view>审核不通过：</view>
    <view>{{friendAll.des}}</view>
  </view>
  <view class="space-between but" v-if="!friendAll.admin_name">
    <view @click="operate('1')">微信转账</view>
    <view @click="operate('2')">发放到零钱</view>
    <view @click="operate('3')">审核不通过</view>
  </view>
  <Withdrawal ref="WithdrawalOpen" :type="type" :order_ID="order_ID" :weatch="friendAll.order_sn" @submit="init">
  </Withdrawal>
</template>

<script setup lang="ts">
  import { showLoading } from '@/utils/prompt';
  import { navBack, navTo } from '@/utils/navigator';
  import Withdrawal from '@c/administrator/BulletBox/withdrawal.vue';
  import { onLoad } from '@dcloudio/uni-app';
  import { toPublish } from '@mqtt';
  import { getProgitInfo } from '@/gql/administrator';
  import { ref } from 'vue';
  const WithdrawalOpen = ref(null)
  const type = ref('')
  const order_ID = ref('')
  const friendAll = ref()
  onLoad((pearm) => {
    order_ID.value = pearm.id
    init()
  })
  /**
   * 获取订单详情
   */
  function init() {
    showLoading()
    const payload = {
      query: getProgitInfo,
      variables: {
        order_id: Number(order_ID.value)
      },
    };
    toPublish(
      'ql/control/getProgitInfo',
      payload,
      (obj : any) => {
        uni.hideLoading();
        const { getProgitInfo } = obj.data;
        friendAll.value = getProgitInfo
      }
    );
  }
  function operate(num : string) {
    type.value = num
    WithdrawalOpen.value.openBankPad()
  }
</script>
<style scoped lang="less">
  .top {
    margin-top: 15rpx;
  }

  .but {
    flex-wrap: wrap;
    width: 96%;
    margin: 2%;

    view {
      width: 48%;
      height: 88rpx;
      background: #3F90FF;
      border-radius: 5px;
      text-align: center;
      line-height: 88rpx;
      margin-top: 30rpx;
      color: #FFFFFF;
    }
  }
</style>